<h2>mach_port_extract_right</h2>
<hr>
<p>
<strong>Function</strong> - Remove the specified right from the target task and return it to the caller.
<h3>SYNOPSIS</h3>
<pre>
<strong>kern_return_t   mach_port_extract_right</strong>
                <strong>(ipc_space_t</strong>                               <var>task</var>,
                 <strong>mach_port_name_t</strong>                          <var>name</var>,
                 <strong>mach_msg_type_name_t</strong>              <var>desired_type</var>,
                 <strong>mach_port_poly_t</strong>                        <var>*right</var>,
                 <strong>mach_msg_type_name_</strong>             <var>*acquired_type</var><strong>);</strong>
</pre>
<h3>PARAMETERS</h3>
<dl>
<p>
<dt> <var>task</var> 
<dd>
[in task send right]
The task holding the port right.
<p>
<dt> <var>name</var> 
<dd>
[in scalar]
The task's name for the port right.
<p>
<dt> <var>desired_type</var> 
<dd>
[in scalar]
IPC type, specifying how the right should be extracted.
<p>
<dt> <var>right</var> 
<dd>
[out random right]
The extracted right.
<p>
<dt> <var>acquired_type</var> 
<dd>
[out scalar]
The type of the extracted right.
</dl>
<h3>DESCRIPTION</h3>
<p>
The <strong>mach_port_extract_right</strong> function extracts a port
right from the target 
task and returns it to the caller as if the task sent the right
voluntarily, using
<var>desired_type</var> as the disposition for the right.  See <strong>mach_msg</strong>.
<p>
The returned value of <var>acquired_type</var> will be
<strong>MACH_MSG_TYPE_PORT_SEND</strong> if a send right is extracted, 
<strong>MACH_MSG_TYPE_PORT_RECEIVE</strong> if a 
receive right is extracted, and <strong>MACH_MSG_TYPE_PORT_SEND_ONCE</strong> if a 
send-once right is extracted.
<h3>NOTES</h3>
<p>
This interface is machine word length specific because of the port name
parameter.
<h3>RETURN VALUES</h3>
<dl>
<p>
<dt> <strong>KERN_INVALID_NAME</strong>
<dd>
<var>name</var> did not denote a right.
<p>
<dt> <strong>KERN_INVALID_RIGHT</strong>
<dd>
<var>name</var> denoted an invalid right.
</dl>
<h3>RELATED INFORMATION</h3>
<p>
Functions:
<a href="mach_port_insert_right.html"><strong>mach_port_insert_right</strong></a>,
<a href="mach_msg.html"><strong>mach_msg</strong></a>.
